#version 330 core

uniform highp vec3 u_reverseLightDirection;
uniform highp vec4 u_color;
uniform highp int u_mode;

varying highp vec3 v_normal;

out vec4 gl_FragColor;

void main() {
    if (u_mode == 0) {
        vec3 normal = normalize(v_normal);
        float light = dot(normal, u_reverseLightDirection);
        gl_FragColor = u_color;
        gl_FragColor.rgb *= light;
    } else {
        gl_FragColor = vec4(0, 0, 0, 1);
    }
}
